home *** CD-ROM | disk | FTP | other *** search
/ Total Network Tools 2002 / NextStepPublishing-TotalNetworkTools2002-Win95.iso / Archive / Misc Servers / Zope.exe / IMAGE.PY < prev    next >
Encoding:
Text File  |  2000-10-31  |  5.9 KB  |  162 lines

  1. ##############################################################################
  2. # Zope Public License (ZPL) Version 1.0
  3. # -------------------------------------
  4. # Copyright (c) Digital Creations.  All rights reserved.
  5. # This license has been certified as Open Source(tm).
  6. # Redistribution and use in source and binary forms, with or without
  7. # modification, are permitted provided that the following conditions are
  8. # met:
  9. # 1. Redistributions in source code must retain the above copyright
  10. #    notice, this list of conditions, and the following disclaimer.
  11. # 2. Redistributions in binary form must reproduce the above copyright
  12. #    notice, this list of conditions, and the following disclaimer in
  13. #    the documentation and/or other materials provided with the
  14. #    distribution.
  15. # 3. Digital Creations requests that attribution be given to Zope
  16. #    in any manner possible. Zope includes a "Powered by Zope"
  17. #    button that is installed by default. While it is not a license
  18. #    violation to remove this button, it is requested that the
  19. #    attribution remain. A significant investment has been put
  20. #    into Zope, and this effort will continue if the Zope community
  21. #    continues to grow. This is one way to assure that growth.
  22. # 4. All advertising materials and documentation mentioning
  23. #    features derived from or use of this software must display
  24. #    the following acknowledgement:
  25. #      "This product includes software developed by Digital Creations
  26. #      for use in the Z Object Publishing Environment
  27. #      (http://www.zope.org/)."
  28. #    In the event that the product being advertised includes an
  29. #    intact Zope distribution (with copyright and license included)
  30. #    then this clause is waived.
  31. # 5. Names associated with Zope or Digital Creations must not be used to
  32. #    endorse or promote products derived from this software without
  33. #    prior written permission from Digital Creations.
  34. # 6. Modified redistributions of any form whatsoever must retain
  35. #    the following acknowledgment:
  36. #      "This product includes software developed by Digital Creations
  37. #      for use in the Z Object Publishing Environment
  38. #      (http://www.zope.org/)."
  39. #    Intact (re-)distributions of any official Zope release do not
  40. #    require an external acknowledgement.
  41. # 7. Modifications are encouraged but must be packaged separately as
  42. #    patches to official Zope releases.  Distributions that do not
  43. #    clearly separate the patches from the original work must be clearly
  44. #    labeled as unofficial distributions.  Modifications which do not
  45. #    carry the name Zope may be packaged in any form, as long as they
  46. #    conform to all of the clauses above.
  47. # Disclaimer
  48. #   THIS SOFTWARE IS PROVIDED BY DIGITAL CREATIONS ``AS IS'' AND ANY
  49. #   EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  50. #   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  51. #   PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL DIGITAL CREATIONS OR ITS
  52. #   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  53. #   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  54. #   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  55. #   USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  56. #   ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  57. #   OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  58. #   OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  59. #   SUCH DAMAGE.
  60. # This software consists of contributions made by Digital Creations and
  61. # many individuals on behalf of Digital Creations.  Specific
  62. # attributions are listed in the accompanying credits file.
  63. ##############################################################################
  64.  
  65. def manage_addImage(id, file, title='', precondition='', content_type=''):
  66.     """
  67.  
  68.     Add a new Image object.
  69.  
  70.     Creates a new Image object 'id' with the contents of 'file'.
  71.  
  72.     """
  73.  
  74.  
  75.  
  76. class Image:
  77.     """
  78.     A Image is a Zope object that contains image content.  A Image
  79.     object can be used to upload or download image information with
  80.     Zope.
  81.  
  82.     Image objects have two properties the define their dimension,
  83.     'height' and 'width'. These are calculated when the image is
  84.     uploaded. For image types that Zope does not understand, these
  85.     properties may be undefined.
  86.  
  87.     Examples:
  88.  
  89.       Using a Image object in Zope is easy.  The most common usage is
  90.       to display the contents of an image object in a web page.  This
  91.       is done by simply referencing the object from DTML::
  92.  
  93.         <dtml-var standard_html_header>
  94.           <dtml-var ImageObject>
  95.         <dtml-var standard_html_footer>
  96.  
  97.       This will generate an HTML IMG tag referencing the URL to the
  98.       Image. This is equivalent to::
  99.  
  100.         <dtml-var standard_html_header>
  101.           <dtml-with ImageObject>
  102.             <img src="<dtml-var absolute_url>">
  103.           </dtml-with>
  104.         <dtml-var standard_html_footer>
  105.         
  106.       You can control the image display more precisely with the 'tag'
  107.       method. For example::
  108.       
  109.         <dtml-var "ImageObject.tag(border=5, align=left)">
  110.     
  111.     """
  112.  
  113.     __constructor__=manage_addImage
  114.  
  115.     __extends__=('OFSP.File.File',)
  116.  
  117.     def tag(height=None, width=None, alt=None,
  118.             scale=0, xscale=0, yscale=0, **args):
  119.         """
  120.         This method returns a string which contains an HTML IMG tag
  121.         reference to the image.
  122.         
  123.         Optionally, the 'height', 'width', 'alt', 'scale', 'xscale'
  124.         and 'yscale' arguments can be provided which are turned into
  125.         HTML IMG tag attributes. Note, 'height' and 'width' are
  126.         provided by default, and 'alt' comes from the 'title_or_id'
  127.         method.
  128.         
  129.         Keyword arguments may be provided to support other or future
  130.         IMG tag attributes.
  131.  
  132.         Permission -- 'View'
  133.         """
  134.  
  135.  
  136.  
  137.  
  138.  
  139.  
  140.  
  141.